/*     */ package net.sourceforge.appgen.model;
/*     */ 
/*     */ import java.io.Serializable;
/*     */ import java.util.ArrayList;
/*     */ import java.util.List;
/*     */ import net.sourceforge.appgen.converter.FirstCharacterLowerCaseConverter;
/*     */ import net.sourceforge.appgen.converter.StringConverter;
/*     */ import net.sourceforge.appgen.util.ConventionUtils;
/*     */ 
/*     */ public class Service
/*     */   implements Serializable
/*     */ {
/*     */   private static final long serialVersionUID = 1L;
/*  34 */   private static final StringConverter firstCharacterLowerCaseConverter = new FirstCharacterLowerCaseConverter();
/*     */   private Entity entity;
/*     */ 
/*     */   public Service(Entity entity)
/*     */   {
/*  39 */     this.entity = entity;
/*     */   }
/*     */ 
/*     */   public String getInterfaceName() {
/*  43 */     return this.entity.getClassName() + "Service";
/*     */   }
/*     */ 
/*     */   public String getClassName() {
/*  47 */     return getInterfaceName() + "Impl";
/*     */   }
/*     */ 
/*     */   public String getInstanceName() {
/*  51 */     return firstCharacterLowerCaseConverter.convert(getInterfaceName());
/*     */   }
/*     */ 
/*     */   public String getInterfaceFullPackageName() {
/*  55 */     return this.entity.getPackageName() + ".service";
/*     */   }
/*     */ 
/*     */   public String getClassFullPackageName() {
/*  59 */     return this.entity.getPackageName() + ".service.impl";
/*     */   }
/*     */ 
/*     */   public String getSuperClassName() {
/*  63 */     return "Service";
/*     */   }
/*     */ 
/*     */   public String getSuperClassFullPackageName() {
/*  67 */     return this.entity.getPackageName() + ".base";
/*     */   }
/*     */ 
/*     */   public List<String> getImportClassNameList(boolean concrete) {
/*  71 */     List list = new ArrayList();
/*     */ 
/*  73 */     if (concrete) {
/*  74 */       list.add(this.entity.getPackageName() + ".util.Paging");
/*     */     }
/*     */ 
/*  77 */     list.add(this.entity.getFullPackageName() + "." + this.entity.getClassName());
/*     */ 
/*  79 */     Criteria criteria = new Criteria(this.entity);
/*  80 */     list.add(criteria.getFullPackageName() + "." + criteria.getClassName());
/*     */ 
/*  82 */     list.add("java.util.List");
/*     */ 
/*  84 */     if (concrete) {
/*  85 */       list.add(getInterfaceFullPackageName() + "." + getInterfaceName());
/*     */     }
/*     */ 
/*  88 */     Dao dao = new Dao(this.entity);
/*     */ 
/*  90 */     if (concrete) {
/*  91 */       list.add(dao.getInterfaceFullPackageName() + "." + dao.getInterfaceName());
/*     */     }
/*     */ 
/*  94 */     if (this.entity.getPrimaryKeyFieldList() != null) {
/*  95 */       for (Field field : this.entity.getPrimaryKeyFieldList()) {
/*  96 */         if ((!field.isCreate()) || (field.getFieldType().indexOf('.') <= 0) || 
/*  97 */           (field.getFieldType().equals("java.lang." + field.getSimpleFieldType())) || 
/*  98 */           (list.contains(field.getFieldType()))) continue;
/*  99 */         list.add(field.getFieldType());
/*     */       }
/*     */ 
/*     */     }
/*     */ 
/* 106 */     if (concrete) {
/* 107 */       for (Field field : this.entity.getFieldList()) {
/* 108 */         if ((field.isCreate()) && ("AttachFile".equals(field.getFieldType()))) {
/* 109 */           if (!list.contains(this.entity.getPackageName() + ".base." + "AttachFile")) {
/* 110 */             list.add(this.entity.getPackageName() + ".base." + "AttachFile");
/*     */           }
/* 112 */           if (!list.contains(this.entity.getPackageName() + ".base.AttachFilePersister")) {
/* 113 */             list.add(this.entity.getPackageName() + ".base.AttachFilePersister");
/*     */           }
/* 115 */           if (!list.contains("org.springframework.core.io.FileSystemResource")) {
/* 116 */             list.add("org.springframework.core.io.FileSystemResource");
/*     */           }
/*     */         }
/*     */       }
/*     */     }
/*     */ 
/* 122 */     return list;
/*     */   }
/*     */ 
/*     */   public List<String> getImportDeclarations(boolean concrete) {
/* 126 */     List list = new ArrayList();
/* 127 */     list.addAll(getImportClassNameList(concrete));
/*     */ 
/* 129 */     String exceptPackageName = getInterfaceFullPackageName();
/* 130 */     if (concrete) {
/* 131 */       exceptPackageName = getClassFullPackageName();
/*     */     }
/*     */ 
/* 134 */     return ConventionUtils.getImportDeclarations(list, exceptPackageName);
/*     */   }
/*     */ 
/*     */   public Entity getEntity() {
/* 138 */     return this.entity;
/*     */   }
/*     */ 
/*     */   public void setEntity(Entity entity) {
/* 142 */     this.entity = entity;
/*     */   }
/*     */ }

/* Location:           C:\Users\lzl6066\Downloads\net.sourceforge.appgen_1.2.0\plugins\net.sourceforge.appgen_1.2.0.201002031718\
 * Qualified Name:     net.sourceforge.appgen.model.Service
 * JD-Core Version:    0.6.0
 */